package top.zhongyy.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import top.zhongyy.pojo.Blog;
import top.zhongyy.pojo.BlogTags;
import top.zhongyy.mapper.BlogTagsMapper;
import top.zhongyy.service.BlogTagsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author Andy
 * @since 2021-03-26
 */
@Service
public class BlogTagsServiceImpl extends ServiceImpl<BlogTagsMapper, BlogTags> implements BlogTagsService {
    @Autowired
    private BlogTagsMapper blogTagsMapper;
    
    @Override
    public void deleteById(Long id) {
        QueryWrapper<BlogTags> wrapper = new QueryWrapper<>();
        wrapper.eq("blogs_id", id);
        blogTagsMapper.delete(wrapper);
    }
    
    @Override
    public List<BlogTags> getBlogIdsByTag(Long tagId) {
        return blogTagsMapper.getBlogIdsByTag(tagId);
    }
    
}
